/* 全局样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header h1 {
    color: #2c3e50;
    margin-bottom: 10px;
}

header p {
    color: #7f8c8d;
}

/* 主要内容区域 */
main {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

section {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

/* 表单样式 */
.form-container {
    margin-bottom: 20px;
}

.form-container h3 {
    color: #34495e;
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.3s, color 0.3s;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

/* 操作表单布局 */
.operation-forms {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.operation-forms .form-container {
    flex: 1;
    min-width: 300px;
}

/* 数据显示区域 */
.data-actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.table-container {
    overflow-x: auto;
    position: relative;
    max-width: 100%;
    width: 100%;
}

table {
    width: max-content;
    border-collapse: collapse;
    table-layout: auto;
    min-width: 800px;
}

/* 键列宽度 */
table th:nth-child(1),
table td:nth-child(1) {
    width: 300px;
    min-width: 300px;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 值列宽度 */
table th:nth-child(2),
table td:nth-child(2) {
    width: 500px;
    min-width: 500px;
    max-width: 500px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 操作列宽度 - 固定在右侧 */
table th:nth-child(3),
table td:nth-child(3) {
    width: 150px;
    min-width: 150px;
    max-width: 150px;
    position: sticky;
    right: 0;
    background-color: #fff;
    z-index: 10;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
}

/* 表头操作列特殊背景 */
table th:nth-child(3) {
    background-color: #f8f9fa;
}

table th, table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

table th {
    background-color: #f8f9fa;
    font-weight: bold;
}

/* 隔行背景色 */
table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

table tbody tr:nth-child(odd) {
    background-color: #fff;
}

/* 确保操作列的背景色与行背景色一致 */
table tbody tr:nth-child(even) td:nth-child(3) {
    background-color: #f8f9fa;
}

table tbody tr:nth-child(odd) td:nth-child(3) {
    background-color: #fff;
}

table tr:hover {
    background-color: #e9ecef;
}

table tr:hover td:nth-child(3) {
    background-color: #e9ecef;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.action-buttons .btn {
    padding: 5px 10px;
    font-size: 14px;
}

.no-data-message {
    text-align: center;
    padding: 20px;
    color: #7f8c8d;
    font-style: italic;
}

/* 批量操作区域 */
.bulk-actions {
    display: flex;
    gap: 15px;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* 搜索结果样式 */
.search-result {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
}

.search-result .key {
    font-weight: bold;
    color: #2c3e50;
}

.search-result .value {
    color: #34495e;
    margin-top: 5px;
}

/* 通知提示样式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    z-index: 1001;
    opacity: 0;
    transition: opacity 0.3s;
}

.notification.success {
    background-color: #2ecc71;
}

.notification.error {
    background-color: #e74c3c;
}

.notification.info {
    background-color: #3498db;
}

.notification.show {
    opacity: 1;
}

/* 页脚样式 */
footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: #7f8c8d;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .operation-forms {
        flex-direction: column;
    }
    
    .data-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .bulk-actions {
        flex-direction: column;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}